package com.spring.demo.core.dao.hibernate;

import java.util.List;

import com.spring.demo.core.dao.IMemberDao;
import com.spring.demo.core.entity.Member;

/**
 * hibernate
 * 
 * @author sean
 * 
 */
public class MemberHibernateDao extends AbstractHibernateDao<Member> implements
		IMemberDao {

	@Override
	public void saveMember(final Member member) {
		save(member);
		if ("zhangsan".equals(member.getName())) {
			throw new RuntimeException("阻止事务提交");
		}
	}

	@Override
	public Member getMemberById(Long id) {
		return findOne(id);
	}

	@Override
	public List<Member> getAllMembers() {
		return findAll();
	}

}
